import { useState } from "react";
import fetchData from "../../utils/ApiFetch";
const apiUrl = process.env.REACT_APP_API_URL;
const debugMode = process.env.REACT_APP_DEBUG_MODE === 'true';
async function getSharedFiles(params) {
    const resp = await fetchData(`${apiUrl}/file/getSharedFiles?sharedCode=${params.sharedId}`);
    return resp.data.files;
}

async function getShared(params) {
    const resp = await fetchData(`${apiUrl}/share/getSharedBySharedCode?sharedCode=${params.sharedId}`);
    return resp.data;
}

export async function sharedFileLoader({ params }) {
    const shared = await getShared(params);
    const sharedFiles = await getSharedFiles(params);
    return { shared, sharedFiles };
}